package com.qf.controller;

import com.baomidou.mybatisplus.extension.api.ApiController;
import com.qf.entity.Hotal;
import com.qf.entity.R;
import com.qf.service.HotalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * (Hotal)表控制层
 *
 * @author makejava
 * @since 2020-09-19 19:57:02
 */
@RestController
@RequestMapping("hotal")
public class HotalController{

    @Autowired
    private HotalService hotalService;
    @RequestMapping("/insert")
    public R<Boolean> insert(@RequestBody Hotal hotal){
        hotalService.save(hotal);
        return new R<Boolean>().setData(true);
    }
    @RequestMapping("/list")
    public R<List<Hotal>> list(){
        List<Hotal> hotalList = hotalService.list();
        return new R<List<Hotal>>().setData(hotalList);
    }
    @RequestMapping("/getById")
    public R<Hotal> queryOne(@RequestParam Integer hid){
        Hotal hotal = hotalService.getById(hid);
        return new R<Hotal>().setData(hotal);
    }
}